<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
echo JhtraqHelper::drawTabs($this->project->slug);
?>
<p></p>
<div class="componentheading">
	<?php echo $this->project->name; ?> - <?php echo JText::_('COM_JHTRAQ_ROADMAP');?>
</div>

<ul class="milestones">
		<?php foreach($this->milestones as $milestone) { ?>
			<li class="milestone">
				<div class="info">
					<h2><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&view=milestone&project='.$this->project->slug.'&milestone='.$milestone['slug']);?>"><?php echo JText::_('COM_JHTRAQ_MILESTONE')?>: <em><?php echo $milestone['milestone']?><?php echo (!empty($milestone['codename']) ? ' <small>"'.$milestone['codename'].'"</small>' : '')?></em></a></h2>
					<p class="date">
						<?php if($milestone['due'] == 0 && $milestone['completed'] == 0) { ?>
						
						<?php } elseif($milestone['completed'] > 0) { ?>
						<?php echo JText::_('COM_JHTRAQ_COMPLETED');?> : <?php echo DATE("Y-m-d", $milestone['completed']);?>
						<?php } elseif($milestone['due'] <= time()) { ?>
						<?php echo JText::_('COM_JHTRAQ_OVERDUE');?> : <?php echo JhtraqHelper::timesince($milestone['due']);?> 
						<?php } elseif($milestone['due'] > time()) { ?>
						<?php echo JText::_('COM_JHTRAQ_DUE_IN');?> : <?php echo JhtraqHelper::timefrom($milestone['due']);?>
						<?php } ?>
					</p>
					<table>
						<tr>
							<td>
								<table class="progress" cellspacing="0">
									<tr>
										<?php if($milestone['tickets']['percent']['closed'] != 0) { ?>
											<td class="closed" width="<?php echo $milestone['tickets']['percent']['closed']?>%">
												<a href="<?php echo JRoute::_('index.php?option=com_jhtraq&view=tickets&project='.$this->project->slug.'&filter[milestone_id]='.$milestone['id'].'&completed=1');?>"></a>
											</td>
										<?php } ?>
										<?php if($milestone['tickets']['percent']['open'] != 0) { ?><td class="open" width="<?php echo $milestone['tickets']['percent']['open']?>%"><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&view=tickets&project='.$this->project->slug.'&filter[milestone]='.$milestone['id']);?>"></a></td><?php } ?>
									</tr>
								</table>
							</td>
							<td class="percent"><?php echo $milestone['tickets']['percent']['closed']?>%</td>
						</tr>
					</table>
					<dl>
						<dt><?php echo JText::_('COM_JHTRAQ_CLOSED_TICKETS')?>:</dt>
						<dd><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&view=tickets&project='.$this->project->slug.'&filter[milestone_id]='.$milestone['id'].'&completed=1');?>"><?php echo $milestone['tickets']['closed']?></a></dd>
						<dt><?php echo JText::_('COM_JHTRAQ_ACTIVE_TICKETS')?>:</dt>
						<dd><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&view=tickets&project='.$this->project->slug.'&filter[milestone_id]='.$milestone['id']);?>"><?php echo $milestone['tickets']['open']?></a></dd>
						<dt><?php echo JText::_('COM_JHTRAQ_TOTAL_TICKETS')?>:</dt>
						<dd><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&view=tickets&project='.$this->project->slug.'&filter[milestone_id]='.$milestone['id']);?>"><?php echo $milestone['tickets']['total']?></a></dd>
					</dl>
					<?php echo $milestone['info']?>
				</div>
			</li>
		<?php } ?>
		</ul>

